local thbattle__hongmeiling_longquan = fk.CreateSkill {

  name = "thbattle__hongmeiling_longquan",

  tags = {},

}



thbattle__hongmeiling_longquan:addEffect(fk.CardEffectCancelledOut, {
  anim_type = "masochism",
  can_trigger = function(self, event, target, player, data)
    if not (target == player and player:hasSkill(thbattle__hongmeiling_longquan.name)) then return false end
    event:setCostData(self, data.to)
    return data.card and data.card.trueName == "slash"
        and not data.to:isKongcheng()
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player,
      { skill_name = thbattle__hongmeiling_longquan.name, prompt = "#thbattle__hongmeiling_longquan_slash" })
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local target_player = event:getCostData(self)
    local target_card = room:askForCardChosen(player, target_player, "h", thbattle__hongmeiling_longquan.name,
      "#thbattle__hongmeiling_longquan-choose_card")
    room:throwCard(target_card, thbattle__hongmeiling_longquan.name, target_player, player)
  end
})
thbattle__hongmeiling_longquan:addEffect(fk.CardUseFinished, {
  anim_type = "masochism",
  can_trigger = function(self, event, target, player, data)
    if not (target == player and player:hasSkill(thbattle__hongmeiling_longquan.name)) then return false end
    local use = data
    if use.card and use.card.trueName == "jink" and use.toCard and use.toCard.trueName == "slash" then
      local effect = use.responseToEvent
      if effect == nil then return false end
      event:setCostData(self, effect.from)
      return effect.to == player and not effect.from:isKongcheng()
    end
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player,
      { skill_name = thbattle__hongmeiling_longquan.name, prompt = "#thbattle__hongmeiling_longquan_jink" })
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local target_player = event:getCostData(self)
    local target_card = room:askForCardChosen(player, target_player, "h", thbattle__hongmeiling_longquan.name,
      "#thbattle__hongmeiling_longquan-choose_card")
    room:throwCard(target_card, thbattle__hongmeiling_longquan.name, target_player, player)
  end
})

return thbattle__hongmeiling_longquan
